//
//  CustomRefreshGifHeader.m
//  EventHouse
//
//  Created by dch on 17/8/1.
//  Copyright © 2017年 sam. All rights reserved.
//

#import "CustomRefreshGifHeader.h"

@implementation CustomRefreshGifHeader

- (void)awakeFromNib
{
    [super awakeFromNib];
}

/** 初始化 */
- (void)prepare
{
    [super prepare];
    
//     设置普通状态的动画图片xiala_0002_图层-62
    NSMutableArray *idleImages = [NSMutableArray array];
   
    for (int i =1; i<20; i++) {
       
        UIImage *image=nil;
       
//        image = [UIImage imageNamed:[NSString stringWithFormat:@"xiala_00%d_图层 %d", 64-i,i]];
        
        if (i>9) {
            image = [UIImage imageNamed:[NSString stringWithFormat:@"xiala_000%d_图层 %d", 19-i,i]];
        }else{
            image = [UIImage imageNamed:[NSString stringWithFormat:@"xiala_00%d_图层 %d", 19-i,i]];
        }
        
        [idleImages addObject:image];
    }
    [self setImages:idleImages duration:1 forState:MJRefreshStateIdle];
    

    [self setImages:idleImages duration:1 forState:MJRefreshStatePulling];

    // 设置正在刷新状态的动画图片
    [self setImages:idleImages duration:1 forState:MJRefreshStateRefreshing];
    
    //隐藏时间
    self.lastUpdatedTimeLabel.hidden = YES;
    //隐藏状态
    self.stateLabel.hidden = YES;
    
    self.cutomLabel = [[UILabel alloc] initWithFrame:CGRectZero];
//    self.cutomLabel.text = @"专业的商务会议报名平台-活动家";
    self.cutomLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:13];
    self.cutomLabel.textColor = [UIColor colorForHex:@"#666666"];
    self.cutomLabel.textAlignment = NSTextAlignmentCenter;
    self.cutomLabel.hidden = YES;
    [self addSubview:self.cutomLabel];
}

/** 摆放子控件frame */
- (void)placeSubviews
{
    [super placeSubviews];
    if (self.cutomLabel.hidden) {
        self.gifView.contentMode = UIViewContentModeCenter;
        return;
    }
    [self.cutomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self).offset(-5);
        make.left.equalTo(self);
        make.right.equalTo(0);
        make.height.equalTo(15);
        make.centerX.equalTo(self.width/2);
    }];
}
//
///** 当scrollView的contentOffset发生改变的时候调用 */
//- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change
//{
//    
//}
///** 当scrollView的contentSize发生改变的时候调用 */
//- (void)scrollViewContentSizeDidChange:(NSDictionary *)change
//{
//    
//}
///** 当scrollView的拖拽状态发生改变的时候调用 */
//- (void)scrollViewPanStateDidChange:(NSDictionary *)change
//{
//    
//}

@end
